#coding=UTF-8

import configparser
'''
#写
config =  configparser.ConfigParser() #
config["com"] = { 'ServerAliveInterval': '45',
			'Compression': 'yes'
			}

config['user'] =  {'name': 'feilong',
			'age': 18}
with open('example.ini', 'w') as configfile:
	config.write(configfile) #将对象写入文件

'''
#读
config = configparser.ConfigParser()

config.read('service.cfg')
sections = config.sections()
server_list = []
for key in sections:
	print(key)
	if key.find("svr")!=-1:
		server_list.append(config[key])

for obj in server_list:
	print(obj.get("name"), obj.get("ip"), int(obj.get("port")), obj.get("wait_server"))
	if obj.get("wait_server")=="true":
		print("_________")

